package com.alm.token.ui.data;


import com.google.gson.annotations.SerializedName;

/**
 * Created by lidengzhou on 16/8/21.
 */


public class Result<T> {

    private static final int WEB_RESP_CODE_SUCCESS = 0;

    @SerializedName("code")
    private int code;
    @SerializedName("message")
    private String message;
    @SerializedName("result")
    private T data;


    /**
     * API是否请求失败
     *
     * @return 失败返回true, 成功返回false
     */
    public boolean isCodeInvalid() {
        return WEB_RESP_CODE_SUCCESS == code ;
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
